<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=9">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/salejihui/css/cssreset.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/salejihui/css/pagination.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/salejihui/css/style.css">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/salejihui/css/style2.css"> 
        <link rel="stylesheet" href="${pageContext.request.contextPath}/salejihui/css/mystyle.css">
        <link rel="stylesheet" href="<%=basePath%>css/mystyle.css">
        
         <script src="${pageContext.request.contextPath}/salejihui/js/jquery-1.8.3.min.js"></script>
         
         <style type="text/css">
			     .bianji1{
				width: 552px;
				height: 369px;
				border:1px solid #ccc;
				border-radius:5px;
				position:absolute;
				top:110px;
				left:50%;
				margin-left:-260px;
				background:#fff;
				display:none;
				z-index:1;
			}
			.bianji1>p{
				width:100%;
				line-height:42px;
				text-indent:2em;
				color:#818181;
				border-bottom:1px solid #dddddd;
			}
			.bianji1>p>img{
				cursor:pointer;
				position:relative;
				left:426px;
			}
			.bianji1>form>p{
				text-align:center;
				margin-bottom:21px;
				color:#555555;
				overflow:hidden;
			}
			.bianji1>form>p>span:nth-of-type(2){
				color:red;
				margin-left:10px;
			}
			
			.bianji1>form>p:nth-of-type(1){
				margin-top:19px;
				
			}
			.bianji1>form>p>input{
				float:none;
				width:300px;
				height:28px;
				text-align:left;
				margin-left:50px;
				outline:none;
				border:1px solid #ccc;
				border-radius:5px;
			}
			
			.bianji1>form>p:nth-of-type(7){
				width:100%;
				height:32px;
				background:#dfe4ea;
				padding:10px 0;
			}
			.bianji1>form>p:nth-of-type(7)>input{
				width: 56px;
				line-height: 28px;
				background:#57c049;
				border:none;
				border-radius:5px;
				color:#fff;
				position:relative;
				left:160px;
				cursor:pointer;
				text-align:center;
			}
			.bianji1>form>p:nth-of-type(7)>input:nth-of-type(1){
				left:190px;
				background:#ccc;
			}
			.smallsa{
				width:100%;
				height:1062px;
				position:absolute;
				top:0px;
				left:0px;
				background:rgba(0,0,0,0.2);
				display:none;
			}
		  </style>
         
        <script>
        	
            $(function(){
            	$(".light3").click(function(e){
			      $('body').css("overflow","hidden")
			        e.preventDefault();
			        $("#cover4").css("display","block");
			        $("#cover4").animate({
			            width: "100%",
			            height: "1800px",
			            top: "0",
			            left: "0"
			        },10);
			        
			    });
			   $(".close").click(function(){
			    	$('body').css("overflow","scroll")
			        $("#cover4").removeAttr("style");
			        $("#cover-content3").removeAttr("style");
			        $('body').css("overflow-y","scroll");
			        $('body').css("overflow-x","hidden")
			    }); 
                
                 $('.sh2').mouseover(function(event) {
                    $('.showhide2').css('display', 'block');
                });
                $('.sh2').mouseout(function(event) {
                    $('.showhide2').css('display', 'none');
                }); 
                
                
            })
        </script> 
        <script>
        	 function save(){
			var url="${pageContext.request.contextPath}/Operate/insertoperate.action";
					var pam={
							oUsername:$("#mingcheng").val(),
							oLoginName:$("#zhanghao").val(),
							oPassword:$("#mima").val(),
							leixing:$("#leibie").val(),
							beizhu:$("#contractContent").val(),
							staffId : $("#staffId").val(),
							winxinhao:$("#winxinhao").val(),
							rPerson:$("#rPerson").val()
						};
					$.post(url,pam,function(data){
						if (data == "success") {
						alert("新建成功");
						location = "${pageContext.request.contextPath}/Operate/count.action";
						} else {
						alert("新建失败，页面发生错误");
						}
				}); 
			    }
		  	//模糊查询判断为空
    	function selectBy(){
    	alert($("#select").val());
    		var vals = $("#select").val();
    		if(vals == ""){
    		alert("不能为空");
    			return false;
    		}else{
    		return true;
    		}
    	}
    	
    	function del(){
		 var delid="";
		var num=0;
		$("input[name='items']").each(function(){
			if($(this).attr("checked")){
				num++;
				delid+=$(this).val()+",";
			}
		});		
		var url="${pageContext.request.contextPath}/Operate/deleteManyId.action";
					var pam={
							delid:delid
							};
					
					$.post(url,pam,function(data){		
							location="${pageContext.request.contextPath}/Operate/count.action";
				}); 
			    }
        	
		  	function selectCheck(){
	    	   var judge = $("#selectCheck").val();
	    	   var objs = document.getElementsByName("items");
			   if(judge == 1){
				   for(var i = 0,l = objs.length;i < l;i++){
		    		   objs[i].checked = true;
		    	   }
				   $("#selectCheck").val(0);
	    	   }else{
	    		   for(var i = 0,l = objs.length;i < l;i++){
		    		   objs[i].checked = false;
		    	   }
	    		   $("#selectCheck").val(1);
	    	   }
	    	   
	    	   checkedShow();
	       }
		  	
		  	function checkedShow(){
		  		var str = "";
	    	    var number = 0;
	    	    var obj = document.getElementsByName("items");
				for(var i = 0,l = obj.length;i < l;i++){
					if(obj[i].checked){
						str += obj[i].value+",";
						number++;
					}
				}    	   
	    			
	    	    if(str == ""){
	    		   $(".yezi1").hide();
	    		   $('.smalltitle p').css('display', 'block');
	    		   $('.light3').css('display', 'inline-block');
	    		   $('.yezi3').css('display', 'inline-block');
	    	    }else{
	    	       $('.smalltitle p').css('display', 'none');
	    		   $(".staff_id").html(str);
	    		   $(".yezi1").show();
	    		   $("#number").html(number);
	    		   $('.light3').css('display', 'none');
	    		   $('.yezi3').css('display', 'none');
	    		   $('.checkok').css('display', 'block');
	    		   $('.del').css('display', 'block');
	    		   $('.shift').css('display', 'block');
	    		   $('.close2').css('display', 'block');
	    		   
	    		   $('.yezi1 .shanchu').css('display', 'block');
	    		   $('.yezi1 .bianji').css('display', 'block');
	    	   }
		  	}
		  	$(function(){
		  		$('.close2').click(function(event) {
		  			$(".yezi1").hide();
		  			$(".yezi").show();
		  			$('.light3').css('display', 'inline-block');
	    		   $('.yezi3').css('display', 'inline-block');
		  		});
		  	})
		  	
		  </script>
    </head>
    <body>
    	<div class="bigbox">
    	<nav class="daohan">
                <ul>
                	<li class="sh1">
                        <a href="<%=basePath %>notice/findByAll.action"><p class="mline"><span class="smallicon" id="current1"></span><span class="navtxt">首页</span></p></a>  
                    </li>
                    <li>
                        <a href="<%=basePath %>client/qiangenzongcount.action?zhuizong=0"  ><p class="mline"><span class="smallicon" id="current11"></span><span class="navtxt"  >用户开发</span></p></a>
                    </li>
                    <li>
                        <a href="<%=basePath %>client/selectDepOrSta.action?start=1">
                            <p class="mline">
                                <span class="smallicon" id="ziji11"></span>
                                <span class="navtxt">代理开发</span>
                            </p>
                        </a>
                    </li>
                    <%--  <li class="sh2">
                        <a href="<%=basePath %>client/selectByStaffAnd.action"><p class="mline"><span class="smallicon one1"></span><span class="navtxt">客户资料</span><span class="ripic"></span></p></a>
                        <div class="showhide2">
                            <a href="<%=basePath %>client/selectByStaffAnd.action" style="font-size:14px;background:#435565;">
                             <p class="mline mline2">
                                <span class="smallicon" id="ziji3"></span>
                                <span class="navtxt" style="font-size: 14px;color:#929da8;">用户资料</span>
                             </p>
                             </a> 

                             <a href="<%=basePath %>client/selectByStaffAnd.action?start=1" style="font-size:14px;background:#435565;">
                             <p class="mline mline2">
                                <span class="smallicon" id="ziji34"></span>
                                <span class="navtxt" id="current2" style="font-size: 14px;color:#929da8;">代理资料</span>
                             </p>
                             </a>    
                        </div>
                    </li> --%>
                    <li>
                        <a href="<%=basePath %>approve/count.action?pageSize=0"><p class="mline"><span class="smallicon one2"></span><span class="navtxt">合同审批</span></p></a> 
                    </li>
                    <li>
                         <a href="<%=basePath%>page/pacts.jsp">
                             <p class="mline"><span class="smallicon one222"></span><span class="navtxt">审批详情</span></p>
                         </a>
                        
                    </li>
                    
                     <li>
                        <a href="<%=basePath %>Operate/count.action" id="sline">
                             <p class="mline"><span class="smallicon" id="yunyin"></span><span class="navtxt" id="current2">运营管理</span></p>
                         </a>
                    </li>  
                    
                   <li>
                        <a href="#"><p class="mline"><span class="smallicon one3"></span><span class="navtxt">产品资源库</span></p></a>
                    </li>
                    <c:if test="${backstage == 1}">
                    	<li>
	                        <a href="<%=basePath %>client/findByAllGr.action"><p class="mline"><span class="smallicon one333"></span><span class="navtxt">后台管理</span></p></a>
	                    </li>
                    </c:if>
                </ul>
            </nav>
            
    		<div class="showbox">
               <h2>运 营 管 理
                	<span class="exit">
						<span class="ex1">姓名:${staff.staff_name}</span>
						<a href="../login/tuichustaff.action" class="ex2"><span class="exicon2"></span>切换账号</a>
						<a href="../login/tuichustaff.action" class="ex3"><span class="exicon3"></span>退出账号</a>
					</span>
                </h2>
                <div class="showbox2">
	    		
	    			<div class="aaa">
		    			<div class="smalltitle">
							<a class="light3" style="margin-top:-48px;width:100px;cursor:pointer;">新建账号</a>
							<form style="display: inline;" action="${pageContext.request.contextPath}/Operate/count.action" method="post">
							<span class="yezi3" style="margin-left: 25px;width: 800px;">
		 						<input type="text" name="condition" value="${condition}" placeholder="&nbsp;&nbsp;&nbsp;&nbsp;名称、微信账号、账号" style="color:#bfbfbf;font-size:12px;border-radius: 16px;outline:none;border:1px solid #e7e7e8;height:36px;width:200px;margin-top: 25px;text-align:left;">
		 						
		 						<input type="submit" value="搜 索" style="line-height:36px;height:36px;width:70px;border-radius: 16px;outline:none;border:none;background:#1fd4fb;color:#fff;margin-left:10px;margin-top: 25px;">
		 					</span>
		 					</form>
		 					<p class="yezi">
								
							 </p>
							 <span class="yezi1">
								 
								 <h4 class="checkok">已选择 <span style="color:#1fd4fb;" id="number"> </span> 项</h4>
								 
								<a class="shanchu" style="width:70px;text-align:center;" onclick="del()">删除</a>
							 
				    				<span class="close2">
				    					<img src="${pageContext.request.contextPath}/salejihui/images/guanbi.png" alt="">
				    				</span>
			    			 </span> 
		    			</div>
	    				
	    				<div class="tab">
	    					<p class="tline tline4">
	    						<span class="xuanze"><input type="checkbox" style="border:none;background:none;" class="check1" id="selectCheck" value="1" onclick="selectCheck()"></span>
	    						<span class="cname">编码</span>
			    		        <span>名称</span>
			    		        <span>负责人</span>
			    		        <span>微信帐号</span>
			    		        <span>账号</span>
			    		        <span>密码</span>
			    		        <span>类别</span>
			    		        <span>备注</span>
	    					</p>
	    					<div class="ps">
	    						
	    					</div>
	    				</div>
	    				<div id="cover4" style=>
							<div id="cover-bg3"></div>
							<div id="cover-content3">
								<h4>新 建 账 号<span class="close"></span></h4>
								<input type="hidden" class="name" id="staffId" name="staffId"
									value="${staff.staff_id}">
								<p class="main" style="margin-top:20px;">
								<span class="leftmain">名 称</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入名称 " class="shurukuang" id="mingcheng">
							</p>
							<p class="main">
								<span class="leftmain">账 号</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入账号 " class="shurukuang" id="zhanghao">
							</p>
							<p class="main">
								<span class="leftmain">负责人&nbsp;&nbsp;&nbsp;&nbsp;</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入负责人 " class="shurukuang" id="rPerson" style="margin-left:6px;">
							</p>
							<p class="main">
								<span class="leftmain">微 信 账 号</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入微信账号 " class="shurukuang" id="winxinhao" style="margin-left:6px;">
							</p>
							<p class="main">
								<span class="leftmain">密 码</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入密码 " class="shurukuang" id="mima">
							</p>
							<p class="main">
								<span class="leftmain">类 别</span>
								<input type="text" placeholder="&nbsp;&nbsp;请输入类别 " class="shurukuang" id="leibie">
							</p>
							<p class="main" style="height:100px;">
								<span class="leftmain" style="position:absolute;left:119px;">备 注</span>
								<textarea name="" id="contractContent" class="shurukuang" style="height:100px;margin-left: 15%;"></textarea>
							</p>
							<p class="main" style="text-align:center;margin-top:15px;">
								<button type="button" class="btn1 btn2" onclick="save()">保存</button>
								<button class="btn1 btn3">取消</button>
							</p>	
						</div>
					 </div>
	    		</div>
	    		<div class="M-box" style="text-align: center;width: 40%;"></div>
	    	</div>
	    	
            </div>
            
    	</div>  
    	
    	<div class="bianji1">
	    		<p>信息修改<img src="../images/guanbi.png" alt="" class="gb"></p>
	    		<form action="javascript:updateguanli()" method="post" onsubmit="return textas()">
	    			<input type="hidden" disabled="disabled" id="staffId1" value="${staff.staff_id}">
	    			<p><span style="margin-right:43px;">姓 名</span><input type="text" disabled="disabled" id="xingming1" value="${staff.staff_name}"></p>
	    			<p><span style="margin-right:28px;">手 机 号</span><input type="text" id="shoujihao1" value="${staff.staff_phone}"><span>*</span></p>
	    			  <p><span style="margin-right:28px;">旧 密 码</span><input type="hidden" id="mimajiu" value="${staff.staff_password}"><input type="text" name="password" id="mimatian" value=""><span>*</span></p> 
	    			<p><span style="margin-right:28px;">新 密 码</span><input type="password" name="password" class="newpass" id="mima" value=""><span>*</span></p>
	    			<p><span style="margin-right:10px;">确 认密 码</span><input type="password" name="password" class="newspass" id="" value=""><span>*</span></p>
	    			<p><span style="margin-right:19px;">邮 箱 号</span><input type="text" id="youxiang1" value="${staff.staff_email}"><span>*</span></p>
	    			<p><input type="button" value="取消" class="qi"><input type="submit" value="确定"></p>
	    		</form>
	    	</div>
    		<div class="smallsa"></div>
    	
    </body>
   
    <script src="${pageContext.request.contextPath}/salejihui/js/jquery.pagination.js"></script>
    <script type="text/javascript">
    function textas(){
    	var shoujihao=$("#shoujihao").val();
    	var mima=$("#mimatian").val();
    	var newpass=$(".newpass").val();
    	var newspass=$(".newspass").val();
    	
    	var p=/\s/;
    	if(shoujihao==""||p.test(shoujihao)){
    		alert("请填写手机号！");
    		return false;
    	}else if(newpass==mima){
    		alert("输入的密码不能与旧密码一致！");
    		return false;
    	}else if(newpass==""||p.test(newpass)){
    		alert("请输入新密码！");
    		return false;
    	}else if(newspass==""||p.test(newspass)){
    		alert("请再次输入新密码！");
    		return false;
    	}else if(newspass!=newpass){
    		alert("与重新设置的密码不相同，请重新输入！");
    		return false;
    	}
    	return true;
    }
    function updateguanli(){
    	var url="${pageContext.request.contextPath}/staff/qianupdate.action";
		var pam={
				staff_id:$("#staffId1").val(),
				staff_password:$("#mimaa").val(),
				staff_phone:$("#shoujihao1").val(),
				staff_userName:$("#xingming1").val(),
				staff_email:$("#youxiang1").val()	
				};
		
		$.post(url,pam,function(data){		
				location="${pageContext.request.contextPath}/Operate/count.action";
	});
    }
    
    $('.ex1').click(function(){
    	$('.bianji1').css('display','block');
    	$('.smallsa').css('display','block');
    })
    $('.gb').click(function(){
    	$('.bianji1').css('display','none');
    	$('.smallsa').css('display','none');
    })
     $('.qi').click(function(){
    	$('.bianji1').css('display','none');
    	$('.smallsa').css('display','none');
    })
    
    
    
		    $('.M-box').pagination({
		    	pageCount: ${PageCount},//总页数
				current: ${PageNum},//当前页码
			callback:function(api){
				var pageNum=api.getCurrent();
				 var condition="${condition}";
		        $.ajax({  
		            type : "POST",  
		            url : "<%=basePath%>Operate/findoperate.action",//路径  
		            data : {  
		            	pageNum : api.getCurrent(),
		            	"condition":condition
		            },
		            success : function(data) {
		            	var number=data[0].number;//总页数
		            	api.setPageCount(number);//动态修改总页数为20页
		            	var pageNum=data[0].pageNum;
		            	var text="";
		            	$('.tline2').remove();
                      for(var i=0;i<data[0].list.length;i++){
                            text=$('<p class="tline tline2 tline4" style="background:#fff;"><span class="xuanze" style="background:#fff;"><input type="checkbox" name="items" class="check1" value="'+data[0].list[i].opid+'" name="items" onclick="checkedShow()"></span><span class="cname">'+data[0].list[i].opid+'</span><span>'+data[0].list[i].oUsername+'</span><span>'+data[0].list[i].rPerson+'</span><span>'+data[0].list[i].winxinhao+'</span><span>'+data[0].list[i].oLoginName+'</span><span>'+data[0].list[i].oPassword+'</span><span>'+data[0].list[i].leixing+'</span><span>'+data[0].list[i].beizhu+'</span></p>');
                            $('.ps').append(text);
                          }
		            }
		        });  
		    }
		},function(api){
		    var pageNum;
		   var condition="${condition}";
		    $.ajax({  
		        type : "POST",  
		        url : "<%=basePath%>Operate/findoperate.action",//路径  
		        data : {  
		        	pageNum : api.getCurrent(),
		        	"condition":condition
		        },
		        success : function(data) {		     
		        	var number=data[0].number;//总页数
		        	api.setPageCount(number);//动态修改总页数为20页
		        	var pageNum=data[0].pageNum;
		        	var text="";  
                    for(var i=0;i<data[0].list.length;i++){
                    	console.log(data);
                    	 text=$('<p class="tline tline2 tline4" style="background:#fff;"><span class="xuanze" style="background:#fff;"><input type="checkbox" class="check1" value="'+data[0].list[i].opid+'" name="items" onclick="checkedShow()"></span><span class="cname">'+data[0].list[i].opid+'</span><span>'+data[0].list[i].oUsername+'</span><span>'+data[0].list[i].rPerson+'</span><span>'+data[0].list[i].winxinhao+'</span><span>'+data[0].list[i].oLoginName+'</span><span>'+data[0].list[i].oPassword+'</span><span>'+data[0].list[i].leixing+'</span><span>'+data[0].list[i].beizhu+'</span></p>');
                            $('.ps').append(text);
                          }                               	
		        }
		    });  
		});
		    
		  
</script>
<script>
         $(function(){  
        	 
        	  //判断浏览器是否支持placeholder属性
        	  supportPlaceholder='placeholder'in document.createElement('input'),
        	 
        	  placeholder=function(input){
        	 
        	    var text = input.attr('placeholder'),
        	    defaultValue = input.defaultValue;
        	 
        	    if(!defaultValue){
        	 
        	      input.val(text).addClass("phcolor");
        	    }
        	 
        	    input.focus(function(){
        	 
        	      if(input.val() == text){
        	   
        	        $(this).val("");
        	      }
        	    });
        	 
        	  
        	    input.blur(function(){
        	 
        	      if(input.val() == ""){
        	       
        	        $(this).val(text).addClass("phcolor");
        	      }
        	    });
        	 
        	    //输入的字符不为灰色
        	    input.keydown(function(){
        	  
        	      $(this).removeClass("phcolor");
        	    });
        	  };
        	 
        	  //当浏览器不支持placeholder属性时，调用placeholder函数
        	  if(!supportPlaceholder){
        	 
        	    $('input').each(function(){
        	 
        	      text = $(this).attr("placeholder");
        	 
        	      if($(this).attr("type") == "text"){
        	 
        	        placeholder($(this));
        	      }
        	    });
        	  }
        	 
        	});
         </script>
</html>
